@extends('master')

@section('修改信息', 'Page Title')

@section('sidebar')
	@parent
@endsection

@section('content')
	<div class="panel panel-info">
		<div class="panel-heading">
			<div class="panel-title">修改信息</div>
		</div>
		<div class="panel-body" >
			<form method="POST" action="/admin/infos/update" class="form-horizontal" enctype="multipart/form-data" role="form">
				{!! csrf_field() !!}
				<fieldset>
					<input type="hidden" name="id" value="{{ $id }}" />
					<div class="form-group">
						<label class="col-md-3 control-label" for="tel">联系方式</label>
						<div class="col-md-9">
							<input id="tel" name="tel" type="text" placeholder="联系方式" class="form-control input-md" value="{{ $tel }}">
						
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-3 control-label" for="email">公司邮箱</label>
						<div class="col-md-9">
							<input id="email" name="email" type="text" placeholder="公司邮箱" class="form-control input-md" value="{{ $email }}">
						
						</div>
					</div>

					<div class="form-group">
						<label class="col-md-3 control-label" for="hr">hr邮箱</label>
						<div class="col-md-9">
							<input id="hr" name="hr" type="text" placeholder="hr邮箱" class="form-control input-md" value="{{ $hr }}">
						
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-3 control-label" for="wechat">公司微信号</label>
						<div class="col-md-9">
							<input id="wechat" name="wechat" type="text" placeholder="公司微信号" class="form-control input-md" value="{{ $wechat }}">
						
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-3 control-label" for="address">公司地址</label>
						<div class="col-md-9">
							<input id="address" name="address" type="text" placeholder="公司地址" class="form-control input-md" value="{{ $address }}">
						
						</div>
					</div>
					<!-- <div class="form-group">
						<label class="col-md-3 control-label" for="ios">ios下载地址</label>
						<div class="col-md-9">
							<input id="ios" name="ios" type="text" placeholder="ios下载地址" class="form-control input-md" value="{{ $ios }}">
						
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-3 control-label" for="android">android下载地址</label>
						<div class="col-md-9">
							<input id="android" name="android" type="text" placeholder="android下载地址" class="form-control input-md" value="{{ $android }}">
						
						</div>
					</div> -->
					<div class="form-group">
						<label class="col-md-3 control-label" for="mall">在线商城</label>
						<div class="col-md-9">
							<input id="mall" name="mall" type="text" placeholder="在线商城" class="form-control input-md" value="{{ $mall }}">
						
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-3 control-label" for="submit"></label>
						<div class="col-md-9">
							<button id="submit" name="submit" class="btn btn-primary">提交</button>
								<span id="errors" style="margin-left: 10%; color: red;">
									@if(count($errors) > 0)
										{{ $errors->all()[0] }}
									@endif
								</span>
						</div>
					</div>
				
				</fieldset>
			
			</form>
		</div>
	</div>
	<script>
		$('#submit').click(function(){

			var tel = $('#tel').val();
			var email = $('#email').val();
			var hr = $('#hr').val();
			var wechat = $('#wechat').val();
			var address = $('#address').val();
			// var ios = $('#ios').val();
			// var android = $('#android').val();
			var mall = $('#mall').val();
			

			<?php if (isset($id)) {?>
				if (!tel || !email || !hr || !wechat || !address || !mall) {

					$('#errors').text('请将字段填写完整!');
					return false;
				}else{

					$('#errors').text('');
				}
			<?php }else{?>

				if (!tel || !email || !hr || !wechat || !address || !ios || !android || !mall) {

					$('#errors').text('请将字段填写完整!');
					return false;
				}else{

					$('#errors').text('');
				}
			<?php }?>
			
		});
	</script>
@endsection